using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using WindowsLive.Writer.Api;

namespace ClipboardLivePlugin
{
    public partial class OptionsForm : Form
    {
        private IProperties options = null;
        public OptionsForm(IProperties options)
        {
            this.options = options;
            InitializeComponent();

            int imageOption = options.GetInt("ImageOption", 1);
            int htmlOption = options.GetInt("HtmlOption", 1);
            int rtfOption = options.GetInt("RtfOption", 1);

            if (imageOption == 1)
                imageRadio1.Checked = true;
            if (imageOption == 2)
                imageRadio2.Checked = true;
            if (imageOption == -1)
                imageRadio3.Checked = true;

            if (htmlOption == 1)
                htmlRadio1.Checked = true;
            if (htmlOption == 2)
                htmlRadio2.Checked = true;
            if (htmlOption == 3)
                htmlRadio3.Checked = true;
            if (htmlOption == -1)
                htmlRadio4.Checked = true;

            if (rtfOption == 1)
                rtfRadio1.Checked = true;
            if (rtfOption == 2)
                rtfRadio2.Checked = true;
            if (rtfOption == -1)
                rtfRadio3.Checked = true;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            int imageOption = 1;
            if (imageRadio1.Checked)
                imageOption = 1;
            if (imageRadio2.Checked)
                imageOption = 2;
            if (imageRadio3.Checked)
                imageOption = -1;
            options.SetInt("ImageOption", imageOption);

            int htmlOption = 1;
            if (htmlRadio1.Checked)
                htmlOption = 1;
            if (htmlRadio2.Checked)
                htmlOption = 2;
            if (htmlRadio3.Checked)
                htmlOption = 3;
            if (htmlRadio4.Checked)
                htmlOption = -1;
            options.SetInt("HtmlOption", htmlOption);

            int rtfOption = 1;
            if (rtfRadio1.Checked)
                rtfOption = 1;
            if (rtfRadio2.Checked)
                rtfOption = 2;
            if (rtfRadio3.Checked)
                rtfOption = -1;
            options.SetInt("RtfOption", rtfOption);

            Close();
        }

    }
}